

$(function(){
	$('#useradddiv').on("click",'.user>.goadd',function(){
		var uname = $.trim($(this).siblings('.c1').text());
		var upwd = $.trim($(this).siblings('.c2').text());
//		var uzt = $(this).siblings('.c6').text();
		
		$.post("ajax/islogin.php",{
			eve: 9//9为增加后台用户
			,uname: uname
			,upwd: upwd
		},function(data, textStatus, reXML){
			//alert(data);
			if(data == 1){
				
				$("#usersdiv").load(location.href+" #usersdiv>*",""); //局部刷新
			}else{
				alert("增加失败:"+data);
			}

		},"text");
	});
	
	//$('.user .goedit').on("click",function(){
	$('#usersdiv').on("click", '.user>.goedit',function(){
		if(confirm('确认要修改吗?')){
			var uid = $.trim($(this).siblings('.c0').text());
			var uname = $.trim($(this).siblings('.c1').text());
			var upwd = $.trim($(this).siblings('.c2').text());
			$.post("ajax/islogin.php",{
			eve: 10//10为修改后台用户
			,uid: uid
			,uname: uname
			,upwd: upwd
		},function(data, textStatus, reXML){
			//alert(data);
			if(data == 1){
				alert("修改成功!:");
				//$("#usersdiv").load(location.href+" #usersdiv>*",""); //局部刷新
			}else{
				alert("增加失败:"+data);
			}

		},"text");
		}
	});
	
	//$('.user .godel').on("click",function(){
	$('#usersdiv').on("click",'.user>.godel',function(){
		if(confirm('确认要删除吗?')){
			var uid = $.trim($(this).siblings('.c0').text());
			var parent = $(this).parent();
			$.post("ajax/islogin.php",{
				eve: 11//11为删除后台用户
				,uid: uid
			},function(data, textStatus, reXML){
				//alert(data);
				if(data == 1){
					parent.remove();
					alert("删除成功!:");
					//$("#usersdiv").load(location.href+" #usersdiv>*",""); //局部刷新
				}else{
					alert("删除失败:"+data);
				}
			},"text");
		}
	});
	
	
});